(async function (){
    const mongoose = require("mongoose")
    await mongoose.connect("mongodb://127.0.0.1:27017/web0213-test")
    const schema = mongoose.Schema({
        name:{
            required: true,
            type: String,
            unique: true
        },
        age:{
            required: true,
            type: Number
        },
        registe_date:{
            default: Date.now(),
            type: Date
        }
    })
    const model = mongoose.model("users",schema)
    try{
        await model.create({name:"zs",age:23})
        console.log("数据插入成功")    
    }catch(err){
        console.log("数据插入失败",err);
    }
    console.log("后续代码执行了");
})()
